#ifndef FRAMEPOOL_HXX
#define FRAMEPOOL_HXX
#include <QMutex>
#include <queue>
class FramePool
{
public:
    FramePool();
	~FramePool();

    inline void setPageSize( int size ) { _pageSize = size; }
    inline int getPageSize() { return _pageSize; }

    inline void setPageCount( int count ) { _pageCount = count; }
    inline int getPageCount() { return _pageCount; }

    void initialize();
	void clear();
    bool pushFrame(const char* buf);
    bool popFrame(char* buf);

	bool isFull();

private:
    int _pageSize;
    int _pageCount;

    QMutex _memoryMutex;
    char* _pool;

    QMutex _keyMutex;
    std::queue<int> _freeKeys;
    std::queue<int> _poolKeys;
};

#endif // FRAMEPOOL_HXX
